/*
 * ActivityPushProgress.java
 * business
 *
 * Created by ChenTao on 2016/10/31.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.data.push.process;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.data.bean.Message;
import com.yidiandao.business.data.push.AbsPushProcess;
import com.yidiandao.business.ui.url.UrlActivity;

/**
 * 活动推送处理
 */
public class ActivityPushProcess extends AbsPushProcess {

    public ActivityPushProcess(Context context, Message message, boolean isForeground) {
        super(context, message, isForeground);
    }

    @Override
    public Intent getClickNotificationJumpActivityIntent() {
        // 点击通知栏时跳转页面的Intent
        return new Intent(mContext, UrlActivity.class);
    }

    @Override
    protected void addExtraDataToNotificationClickReceiverIntent(Intent intent) {
        // 往显示通知的Intent中注入活动的额外信息。因为点击跳转的时候需要这些信息
        // 跳转到优惠活动（UrlActivity）页面需要额外的数据
        intent.putExtra(Intents.TITLE, mMessage.getTitle());
        intent.putExtra(Intents.HTTP_URL, mMessage.getUrl());
    }

    @Override
    public void onDialogEnsureButtonClick(Message message) {
        UrlActivity.actionStart((Activity) mContext, message.getUrl());
    }
}
